package com.syq.page;


import java.io.Serializable;


public class PageInfo implements Serializable {

	private static final long serialVersionUID = 1878154374135400744L;


    private int pageSize = 5;//每页大小

    private int pageCount = 0;//总页数

    private transient int itemCount = 0;//总记录数
    
    private int currPage = 1;

    private int offset = 0;
    
    public boolean isPage = false;


	public int getPageCount() {
		return pageCount;
	}

	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}

	public boolean isPage() {
		return isPage;
	}

	public void setPage(boolean isPage) {
		this.isPage = isPage;
	}

	public int getItemCount() {
		return itemCount;
	}


//从数据库得到总记录数 就同时得到了 总页数
	public void setItemCount(int itemCount) {
		this.itemCount = itemCount;
		this.pageCount = (itemCount + pageSize - 1) / pageSize;
	}



	public int getPageSize() {
		return pageSize;
	}



	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}



	public int getCurrPage() {
		return currPage;
	}

	public int getOffset() {
		return offset;
	}

	public void setOffset(int offset) {
		this.offset = offset;
	}

	public void setCurrPage(int currPage) {
		this.currPage = currPage;
		this.offset = (currPage - 1) * pageSize;
	}

	public PageInfo(int currPage,int pageSize) {
		this.pageSize = pageSize;
		this.currPage = currPage;
	}
}

